#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;
const int N = 700, M = 1e5 + 10;
const double eps = 0.000001;

int n;
int h[N], e[M], w[M], ne[M], idx;
double dist[N];
int q[N], cnt[N];
bool st[N];

void add(int a, int b, int c){
    e[idx] = b;
    ne[idx] = h[a];
    w[idx] = c;
    h[a] = idx ++;
}


bool check(double mid){
    memset(cnt, 0, sizeof cnt);
    memset(st, 0, sizeof st);
    memset(dist, 0, sizeof dist);
    int hh = 0, tt = 0;

    for(int i = 0; i < 676; i ++){
        q[tt++] = i;
        st[i] = true;
    }
    int count = 0;
    while(hh != tt){
        int t = q[hh++];

        st[t] = false;

        if(hh == N) hh = 0;

        for(int i = h[t]; ~i; i = ne[i]){
            int j = e[i];
            double dis = w[i] - mid;
            if(dist[j] < dist[t] + dis){
                dist[j] = dist[t] + dis;
                cnt[j] = cnt[t] + 1;

                if(++count > 10000) return true;

                if(!st[j]){
                    q[tt++] = j;
                    st[j] = true;

                    if(tt == N) tt = 0;
                }

                if(cnt[j] >= N){
                    return true;
                }
                
            }
        }
    }

    return false;

}

int main(){

    char str[1010];
    while(scanf("%d", &n), n){
        memset(h, -1, sizeof h);
        idx = 0;
        for(int i = 0; i < n; i ++){
            scanf("%s", str);
            int len = strlen(str);
            if(len >= 2){
                int left = (str[0] - 'a') * 26 + (str[1] - 'a');
                int right = (str[len - 2] - 'a') * 26 + (str[len - 1] - 'a');
                add(left, right, len);
            }
        }

        if(!check(0)) printf("No solution\n");
        else
        {
        double l = 0, r = 1000;
        while(r - l > eps)
        {
            double mid = (l + r) / 2.0;
            if(check(mid)) l = mid;
            else r = mid;
        }
        printf("%lf\n", l);
        }
        
    }
}